Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use representation instances for reducers #1089

Merged
merged 3 commits into from
Jan 6, 2025

Conversation

jamesbradleym
Copy link
Contributor

@jamesbradleym jamesbradleym commented Dec 24, 2024

BACKGROUND:

  • Reducers were not being rendered properly do to (presumably) geometry conflicts from 2 sweeps intersecting.

DESCRIPTION:

  • Switches from using this.Representation to this.RepresentationInstances for Reducer representations.

TESTING:

  • Load up a workflow with reducers of various sizes and see them no longer missing.
Screenshot 2024-12-24 at 4 40 12 PM Screenshot 2024-12-24 at 4 39 38 PM

FUTURE WORK:

  • Is there any future work needed or anticipated? Does this PR create any obvious technical debt?

REQUIRED:

  • All changes are up to date in CHANGELOG.md.

COMMENTS:

  • Any other notes.

This change is Reviewable

@jamesbradleym jamesbradleym requested a review from wynged December 24, 2024 21:41
Copy link
Member

@wynged wynged left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: 1 change requests, 0 of 1 approvals obtained (waiting on @jamesbradleym)


Elements.MEP/src/Fittings/Reducer.cs line 75 at r1 (raw file):

                 .Concat(this.End.GetArrow(endNodeTransform.Origin)).Concat(GetExtensions());

            this.RepresentationInstances.Add(new RepresentationInstance(new SolidRepresentation(sweep1), this.Material));

This is not really the pattern we want when we use representation instances. The goal of representation instances was to make it so we re-use representation, but with how you have done it here we're making new instances every time. See the UpdateRepresentation method in Elbow.cs

However, if I recall correctly getting reducer representations to appear correctly was tricky because they both have a direction, large->small vs small->large, and they can be eccentric, which means their transform orientation is that much trickier.

Do we have a theory about why this use of reprsentation instances works when old style representations doesn't work?

Copy link
Contributor Author

@jamesbradleym jamesbradleym left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 1 change requests, 0 of 1 approvals obtained (waiting on @wynged)


Elements.MEP/src/Fittings/Reducer.cs line 75 at r1 (raw file):

Previously, wynged (Eric Wassail) wrote…

This is not really the pattern we want when we use representation instances. The goal of representation instances was to make it so we re-use representation, but with how you have done it here we're making new instances every time. See the UpdateRepresentation method in Elbow.cs

However, if I recall correctly getting reducer representations to appear correctly was tricky because they both have a direction, large->small vs small->large, and they can be eccentric, which means their transform orientation is that much trickier.

Do we have a theory about why this use of reprsentation instances works when old style representations doesn't work?

Using FittingRepresentationStorage.SetFittingRepresentation results in bad geometry transforms it looks like, is that the right implementation? I had taken this pattern from https://github.com/hypar-io/AECTech2023/blob/0e6db42d4f20bc85a03d565cdd16a7a1e726a063/ExampleFunctions/Precincts/dependencies/Site.cs#L15-L22 which I thought was on the newer side but maybe that wasn't the right place to look.

Screenshot 2024-12-26 at 11.27.53 AM.png

Copy link
Member

@wynged wynged left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 1 change requests, 0 of 1 approvals obtained (waiting on @jamesbradleym)


Elements.MEP/src/Fittings/Reducer.cs line 75 at r1 (raw file):

Previously, jamesbradleym wrote…

Using FittingRepresentationStorage.SetFittingRepresentation results in bad geometry transforms it looks like, is that the right implementation? I had taken this pattern from https://github.com/hypar-io/AECTech2023/blob/0e6db42d4f20bc85a03d565cdd16a7a1e726a063/ExampleFunctions/Precincts/dependencies/Site.cs#L15-L22 which I thought was on the newer side but maybe that wasn't the right place to look.

Screenshot 2024-12-26 at 11.27.53 AM.png

hmmm... yea, that rings a bell, other fittings can more easily have a transform that orients them in space, but we never made transforms of reducers make total sense...
ok, it's not important to solve now, let's just add a TODO here that explains that we'd rather use representationInstances with a Factory pattern like other fittings because we want the advantage of instancing geometry, but because reducers have unique orientation requirements we haven't implemented it yet.

Copy link
Contributor Author

@jamesbradleym jamesbradleym left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 1 change requests, 0 of 1 approvals obtained (waiting on @wynged)


Elements.MEP/src/Fittings/Reducer.cs line 75 at r1 (raw file):

Previously, wynged (Eric Wassail) wrote…

hmmm... yea, that rings a bell, other fittings can more easily have a transform that orients them in space, but we never made transforms of reducers make total sense...
ok, it's not important to solve now, let's just add a TODO here that explains that we'd rather use representationInstances with a Factory pattern like other fittings because we want the advantage of instancing geometry, but because reducers have unique orientation requirements we haven't implemented it yet.

In that case could we just modify the SetFittingRepresentation to work with Reducer as well? As implemented: Add a boolean for transforming and a boolean for unioning?

Copy link
Member

@wynged wynged left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 2 files at r2, all commit messages.
Reviewable status: 1 change requests, 0 of 1 approvals obtained (waiting on @jamesbradleym)


Elements.MEP/src/Fittings/Reducer.cs line 75 at r1 (raw file):

Previously, jamesbradleym wrote…

In that case could we just modify the SetFittingRepresentation to work with Reducer as well? As implemented: Add a boolean for transforming and a boolean for unioning?

oh sorry, since I don't see a representation hash method being implemented, which means we're not actually re-using the representations from the storage, I think we should just leave the TODO. as it is now we're sort of looking like we're using the storage but we're not really, representations won't ever be re-used, unless i'm mis-reading something.

@jamesbradleym jamesbradleym requested a review from wynged January 3, 2025 21:11
Copy link
Contributor Author

@jamesbradleym jamesbradleym left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 1 change requests, 0 of 1 approvals obtained (waiting on @wynged)


Elements.MEP/src/Fittings/Reducer.cs line 75 at r1 (raw file):

Previously, wynged (Eric Wassail) wrote…

oh sorry, since I don't see a representation hash method being implemented, which means we're not actually re-using the representations from the storage, I think we should just leave the TODO. as it is now we're sort of looking like we're using the storage but we're not really, representations won't ever be re-used, unless i'm mis-reading something.

Done.

Copy link
Member

@wynged wynged left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 2 of 2 files at r3, all commit messages.
Reviewable status: :shipit: complete! 1 of 1 approvals obtained

@jamesbradleym jamesbradleym merged commit 114dbb4 into master Jan 6, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants